var vm = new Vue({
	el:'#app',
	data:{
	number:"",
	prop: ""
	},
	 components: {
        "header-com" : headerCom,
		"count-com" : countCom,
		"popup-com" : popupCom
    },
    methods:{
    	oneHun:function(){
    		this.number = 100;
    	},
    	thrHun:function(){
    		this.number = 300;
    	},
    	oneTho:function(){
    		this.number = 1000;
    	},
    	twoTho:function(){
    		this.number = 2000;
    	},
    	thrTho:function(){
    		this.number = 3000;
    	},
    	modify:function(){
    		this.number = "";
    	},
    	cancel:function(){
    		window.location.href = "../business";
    	},
    	Submission:function(){
			if(this.number == ""){
				this.prop = "请选择或输入取款金额";
				return false;
			}
    		if (this.number%100 !== 0) {
				this.prop = "请输入100的整数倍";
    		}else if (this.number > 5000) {
				this.prop = "一次最多取款5000元";
    		}else{
    			const num = Qs.stringify({
				"money": this.number
			})
    		axios.post("./withdraw",num)
            .then((res)=> {
               var code = res.data.code;
                var describe = res.data.describe;
                switch(code){
					case 811:
					this.prop = "交易失败";
					break;
                    case 0:
                    window.location.href = "./successfulWithdraw";
                    break;
                    case 411:
					this.prop = describe;
                    break;
                    case 511:
					this.prop = describe;
                    break;
                    case 512:
					this.prop = describe;
                    break;
                    case 513:
					this.prop = describe;
                    break;
                    case 514:
					this.prop = "取款金额超出今日取款限额，当前可取金额为"+ res.data.data;
                    break;
                    case 521:
					this.prop = "取款金额超出取款机当前可用余额，当前ATM可取金额为"+ res.data.data;
                    break;
                }
            })
            .catch(function(error) {
                alert(error);
            })
    		}
    		

    	}
    }
})
